﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Produce.Read.Api.Application.Commands.PregnantCommands;

namespace S.Produce.Read.Api.Controllers
{
    /// <summary>
    /// 种母妊检控制器(读)
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PregnantsController : ControllerBase
    {
        private readonly IMediator mediator;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mediator"></param>
        public PregnantsController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 获取种母妊检信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> PregnantSelect([FromQuery] PregnantSelectCommand command)
        {
            return Ok(await mediator.Send(command));
        }

        /// <summary>
        /// 获取所有种母妊检信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> PregnantAllInfo([FromQuery] HintPregnantConnand command)
        {
            return Ok(await mediator.Send(command));
        }

        /// <summary>
        /// 回填种母妊检信息
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> PregnantBackfill([FromQuery]PregnantBackfillCommand command)
        {
            return Ok(await mediator.Send(command));
        }
    }
}
